package com.zhong.gulimall.product.feign;

import com.zhong.common.to.SkuReductionTo;
import com.zhong.common.to.SpuBoundTo;
import com.zhong.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    /**
     * 1、CouponFeignService。saveSpuBounds（SpuBoundTo）；
     *      1）、@RequestBody将这个对象转为json
     *      2）、找到gulimall-coupon服务，发送/coupon/spubounds/save请求，将上一步的json放在请求体发送请求
     *      3）、对方服务收到请求，请求体的json转为参数对象
     * 所以对象里的属性名一样，就可以传
     * @param spuBoundTo
     * @return
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);

}
